import java.util.Scanner;

public class C_1_13_2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner((System.in));
        int we = sc.nextInt();
        int[] month = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        we += 12;
        if (we % 7 == 5) {
            System.out.println(1);
        }
        for (int i = 2; i <= 12; i++) {
            we += month[i-1];
            we %= 7;
            if(we == 5){
                System.out.println(i);
            }
        }
    }
}